<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Home extends CI_Controller {

	function __construct()
	{
		parent::__construct();
	}

 	function index()
 	{
   		if($this->session->userdata('logged_in'))
   		{
	     $session_data = $this->session->userdata('logged_in');
	     $data['username'] = $session_data['username'];
		 
		 $data['_scripts'] = '';
		 $data['_styles'] = '';
		 $data['head'] = '';
		 $data['schulname'] = 'Berufskolleg Uerdingen';
		 $data['navi'] = $this->load->view('login/adminnavi_view', $data,TRUE);
		 $data['login'] = '';
		 $data['content'] = $this->load->view('login/adminhome_view', $data,TRUE);
		 $data['footer'] = $this->load->view('templates/footer', $data, TRUE);
		 
		 $this->load->view('MeinBKU_Template/MeinBKU_Template/template', $data);
   		}
   		else
   		{
     	//If no session, redirect to login page
     	redirect('welcome', 'refresh');
   		}
	}
	
	function lehrerindex()
 	{
   		if($this->session->userdata('logged_in'))
	   	{
		     $session_data = $this->session->userdata('logged_in');
		     $data['username'] = $session_data['username'];
			 
			 $data['_scripts'] = '';
			 $data['_styles'] = '';
			 $data['head'] = '';
			 $data['schulname'] = 'Berufskolleg Uerdingen';
			 $data['navi'] = $this->load->view('login/lehrernavi_view', $data,TRUE);
			 $data['login'] = '';
			 $data['content'] = $this->load->view('login/lehrerhome_view', $data,TRUE);
			 $data['footer'] = $this->load->view('templates/footer', $data, TRUE);
			 
			 $this->load->view('MeinBKU_Template/MeinBKU_Template/template', $data);
	   	}
	   	else
	   	{
	     	//If no session, redirect to login page
	     	redirect('welcome', 'refresh');
	   	}
 	}
	
	function schuelerindex()
 	{
   		if($this->session->userdata('logged_in'))
	   	{
		     $session_data = $this->session->userdata('logged_in');
		     $data['username'] = $session_data['username'];
			 
			 $data['_scripts'] = '';
			 $data['_styles'] = '';
			 $data['head'] = '';
			 $data['schulname'] = 'Berufskolleg Uerdingen';
			 $data['navi'] = $this->load->view('login/schuelernavi_view', $data,TRUE);
			 $data['login'] = '';
			 $data['content'] = $this->load->view('login/schuelerhome_view', $data,TRUE);
			 $data['footer'] = $this->load->view('templates/footer', $data, TRUE);
			 
			 $this->load->view('MeinBKU_Template/MeinBKU_Template/template', $data);
	   	}
	   	else
	   	{
	     	//If no session, redirect to login page
	     	redirect('welcome', 'refresh');
	   	}
 	}

	function logout()
	{
	    $this->session->unset_userdata('logged_in');
		$this->session->unset_userdata('klausuren_data');
		$this->session->unset_userdata('fragen_data');	
		$this->session->unset_userdata('aktuellefrage');
		$this->session->unset_userdata('antwort_data');		
	    session_destroy();
	    redirect('home', 'refresh');
	}

}

?>
